/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.db.SMSMessageManager;
/*    */ import com.newcrm.exception.DBException;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import java.sql.SQLException;
/*    */ import java.util.List;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import net.sf.json.JSONObject;
/*    */ 
/*    */ public class ListSMSMsg extends AbstractAction
/*    */ {
/*    */   public ListSMSMsg(AbstractHttpServlet servlet)
/*    */   {
/* 27 */     super(servlet);
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 34 */     int customerId = Util.getURLIntParameter(request
/* 35 */       .getParameter("customerId"));
/* 36 */     int parentCustomerId = Util.getURLIntParameter(request
/* 37 */       .getParameter("parentCustomerId"));
/*    */ 
/* 39 */     boolean isPeople = true;
/*    */ 
/* 42 */     if (customerId == parentCustomerId) {
/* 43 */       isPeople = false;
/*    */     }
/*    */ 
/* 46 */     SMSMessageManager manager = new SMSMessageManager();
/*    */ 
/* 48 */     List result = null;
/*    */ 
/* 50 */     response.setContentType("text/html;charset=utf-8");
/* 51 */     PrintWriter out = response.getWriter();
/* 52 */     JSONObject jsonObject = new JSONObject();
/*    */     try
/*    */     {
/* 55 */       if (isPeople)
/* 56 */         result = manager.getPeopleSMSMsg(customerId);
/*    */       else {
/* 58 */         result = manager.getCompanySMSMsg(parentCustomerId);
/*    */       }
/* 60 */       jsonObject.put("error", "0");
/* 61 */       jsonObject.put("smsMsgs", result);
/*    */     } catch (DBException e) {
/* 63 */       jsonObject.put("error", "1");
/*    */     } catch (SQLException e) {
/* 65 */       jsonObject.put("error", "1");
/*    */     }
/* 67 */     out.println(jsonObject);
/* 68 */     out.flush();
/* 69 */     out.close();
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.ListSMSMsg
 * JD-Core Version:    0.6.1
 */